<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>盘丝洞-微商城</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
	<link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <link rel="stylesheet" href="css/login.css">
    <script src="js/vue.js"></script>
    <script src="js/jquery.1.8.js"></script>

</head>
<body >

        <div id="app">
            <div class="out">
        
            <div class="top">
              盘丝洞微商城
           </div>
        
            <div class="text">
                <input type="text" v-model="loginName" placeholder="请输入用户名"/>
            </div>
        
            <div class="text">
                <input type="text" v-model="pwd"  placeholder="请输入密码"/>
            </div>
        
            <div class="buttom" @click="login">
                登录
           </div>
           <div class="register" text-align="center" @click="register">
            注册
        </div>
            </div>
        </div>
    
        
</body>

    <script>
      var vm=new Vue({
          el:'#app',
          data:{
              loginName:'',
              pwd:''
          },
          methods:{
              login(){
                  $.ajaxSetup({
                      contentType:"application/json;charset=utf-8"
                  });
                  var data ={'loginName':this.loginName,"pwd":this.pwd}

                  $.post("http://api.tutestudio.net/api/login",JSON.stringify(data),function(res){
                      if(res.code==200){
                          alert("登录成功")
                          location.href="index.html"
                      }
                      else{
                          alert("登陆失败")
                      }
                  })
              },
              register(){
                  location.href="register.html"
              }
          }
      })
  </script>

    

</body>
</html>